home *** CD-ROM | disk | FTP | other *** search
/ Cream of the Crop 26 / Cream of the Crop 26.iso / os2 / timidsrc.zip / output.h < prev    next >
C/C++ Source or Header  |  1996-05-20  |  2KB  |  79 lines

  1. /* 
  2.  
  3.     TiMidity -- Experimental MIDI to WAVE converter
  4.     Copyright (C) 1995 Tuukka Toivonen <toivonen@clinet.fi>
  5.  
  6.     This program is free software; you can redistribute it and/or modify
  7.     it under the terms of the GNU General Public License as published by
  8.     the Free Software Foundation; either version 2 of the License, or
  9.     (at your option) any later version.
  10.  
  11.     This program is distributed in the hope that it will be useful,
  12.     but WITHOUT ANY WARRANTY; without even the implied warranty of
  13.     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  14.     GNU General Public License for more details.
  15.  
  16.     You should have received a copy of the GNU General Public License
  17.     along with this program; if not, write to the Free Software
  18.     Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  19.  
  20.     output.h
  21.  
  22. */
  23.  
  24. /* Data format encoding bits */
  25.  
  26. #define PE_MONO     0x01  /* versus stereo */
  27. #define PE_SIGNED    0x02  /* versus unsigned */
  28. #define PE_16BIT     0x04  /* versus 8-bit */
  29. #define PE_ULAW     0x08  /* versus linear */
  30. #define PE_BYTESWAP    0x10  /* versus the other way */
  31.  
  32. typedef struct {
  33.   int32 rate, encoding;
  34.   int fd; /* file descriptor for the audio device */
  35.   int32 extra_param[5]; /* e.g. buffer fragments, output channel, ... */
  36.   char *id_name, id_character;
  37.   char *name; /* default device or file name */
  38.  
  39.   int (*open_output)(void); /* 0=success, 1=warning, -1=fatal error */
  40.   void (*close_output)(void);
  41.   void (*output_data)(int32 *buf, int32 count);
  42.   void (*flush_output)(void);
  43.   void (*purge_output)(void);
  44. } PlayMode;
  45.  
  46. extern PlayMode *play_mode_list[], *play_mode;
  47. extern int init_buffers(int kbytes);
  48.  
  49. /* Conversion functions -- These overwrite the int32 data in *lp with
  50.    data in another format */
  51.  
  52. /* 8-bit signed and unsigned*/
  53. extern void s32tos8(int32 *lp, int32 c);
  54. extern void s32tou8(int32 *lp, int32 c);
  55.  
  56. /* 16-bit */
  57. extern void s32tos16(int32 *lp, int32 c);
  58. extern void s32tou16(int32 *lp, int32 c);
  59.  
  60. /* byte-exchanged 16-bit */
  61. extern void s32tos16x(int32 *lp, int32 c);
  62. extern void s32tou16x(int32 *lp, int32 c);
  63.  
  64. /* uLaw (8 bits) */
  65. extern void s32toulaw(int32 *lp, int32 c);
  66.  
  67. /* little-endian and big-endian specific */
  68. #ifdef LITTLE_ENDIAN
  69. #define s32tou16l s32tou16
  70. #define s32tou16b s32tou16x
  71. #define s32tos16l s32tos16
  72. #define s32tos16b s32tos16x
  73. #else
  74. #define s32tou16l s32tou16x
  75. #define s32tou16b s32tou16
  76. #define s32tos16l s32tos16x
  77. #define s32tos16b s32tos16
  78. #endif
  79.